package com.neusoft.controller;

import com.neusoft.domain.Business;
import com.neusoft.domain.Employee;
import com.neusoft.domain.Result;
import com.neusoft.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private LoginService loginService;
    @PostMapping("/employee")
    public Result loginEmployee(@RequestBody Employee employee){
        Employee result = loginService.loginEmployee(employee);
        if (result==null){
            return Result.fail("登录失败");
        }
        return Result.success(result);
    }
    @PostMapping("/business")
    public Result loginBusiness(@RequestBody Business business){
        Business result = loginService.loginBusiness(business);
        if (result==null){
            return Result.fail("登录失败");
        }
        return Result.success(result);
    }
}
